10 REM PLOT ARRAY FACTOR
20 REM "ANTENNA DESIGN USING PERSONAL COMPUTERS"
30 DIM FLDA(360)
40 DEF FNLOG10(X)=.4343*LOG(X)
50 KEY OFF
60 SCREEN 0,1
70 CLS
80 COLOR 1,0
90 PRINT "PATTERN OF A UNIFORM LINEAR ISOTROPIC ARRAY"
100 COLOR 4,0
110 PRINT
120 INPUT "WHAT IS THE FREQUENCY(MHz)";FMC
130 INPUT "HOW MANY ELEMENTS";N
140 INPUT "WHAT IS THE ELEMENT SPACING(meters)";D
150 INPUT "WHAT IS THE PHASING(degrees)";ALP
160 COLOR 14,0
170 PI=3.14159
180 D=D*FMC/300
190 ALPR=ALP*PI/180
200 ROD=PI/180
210 REM FILL ARRAY WITH FIELD
220 FMAX=0
230 FOR TH=0 TO 180
240 THR=TH*ROD
250 PSI=2*PI*COS(THR)*D+ALPR
260 DEN=SIN(PSI/2)
270 FLDA(TH)=1
280 IF ABS(DEN)>.01 THEN FLDA(TH)=SIN(N*PSI/2)/(N*DEN)
290 FLDA(TH)=ABS(FLDA(TH))
300 IF FLDA(TH)>FMAX THEN FMAX=FLDA(TH)
310 NEXT TH
320 REM FILL OTHER HALF OF ARRAY
330 FOR TH=181 TO 360
340 FLDA(TH)=FLDA(360-TH)
350 NEXT TH
360 PRINT
370 REM NORMALIZE DATA
380 FOR TH=0 TO 360
390 FM=FLDA(TH)/FMAX
400 IF FM<.0316 THEN FM=.0316
410 FLDA(TH)=20*FNLOG10(FM)
420 NEXT TH
430 REM PREPARE FOR PLOTTING
440 SCREEN 2,0
450 VIEW (262,20)-(638,188)
460 WINDOW (-1,-1)-(1,1)
470 REM COMPUTE SCAN ANGLE
480 Y=-ALPR/(2*PI*D)
490 IF ABS(Y)>1 THEN Y=Y/ABS(Y)
500 IF Y*Y=0 THEN THMAX=PI/2
510 IF Y*Y<1 AND Y<>0 THEN THMAX=ATN(SQR(1-Y*Y)/Y)
520 IF Y=1 THEN THMAX=0
530 IF Y=-1 THEN THMAX=PI
540 THMAX=THMAX*180/PI
550 IF THMAX<0 THEN THMAX=THMAX+180
560 PRINT USING "SCAN ANGLE=###.# deg.";90-THMAX
570 REM PLOT GRID
580 CIRCLE (0,0),1,,,,.45
590 CIRCLE (0,0),.666,,,,.45
600 CIRCLE (0,0),.333,,,,.45
610 FOR THD=0 TO 150 STEP 30
620 TH=THD*PI/180
630 LINE (COS(TH),SIN(TH))-(-COS(TH),-SIN(TH))
640 NEXT THD
650 PSET (FLDA(0)/30+1,0)
660 FOR TH=0 TO 360
670 THR=TH*PI/180
680 RAD=FLDA(TH)/30+1
690 LINE -(RAD*COS(THR),RAD*SIN(THR))
700 NEXT TH
710 REM FIND BEAMWIDTH
720 TH=INT(THMAX-.5)
730 TH=TH+1
740 IF FLDA(TH)>-3 THEN GOTO 730
750 TH0=(-3-FLDA(TH-1)+(TH-1)*(FLDA(TH)-FLDA(TH-1)))/(FLDA(TH)-FLDA(TH-1))
760 BW=(TH0-THMAX)*2
770 PRINT USING "3-dB BEAMWIDTH=###.# deg.";BW
780 PRINT "10 dB/DIV."
790 PRINT
800 INPUT "CONTINUE(Y,N)";K$
810 IF K$<>"N" THEN GOTO 60
820 SCREEN 0,1
830 KEY ON
840 END
